---瞬移
---@class BuffEffect12 : BaseBuffEffect
BuffEffect12 = ClientFight.CreateClass("BuffEffect12", ClientFight.BaseBuffEffect)
local t = BuffEffect12

---@param fight Fight
---@param buff FighterBuff
function t:action(fight, buff, ...)
    local parameters = { ... }
    local target = buff.target
    local fighter = buff.source

    -- 瞬移
    local leftOrRight = FighterUtils.leftOrRight1(target, fighter);
    local targetX = target.position.x + leftOrRight *
    buff.buffBean.f_BuffEffectValue[1] / Global.TEN_THOUSANDTH;

    local targetPos = Vector2(targetX, target.position.y);
    local distance = DistanceUtil.countDistance(fighter.position, targetPos);
    FighterManager.changePosition(fight, fighter, distance, targetPos.x, targetPos.y, 0, true, true, true);
    --fighter.position.setX(target.position.getX() +
    --        leftOrRight * (double) buff.buffBean.f_BuffEffectValue[0] / Global.TEN_THOUSANDTH);
    --fighter.position.setY(target.position.getY());


    --fighterManager.checkOut(fighter, Global.FIGHT_INNER_ROUND);

    -- 16修特转向bug，需要发给客户端目标ID
    local commandInfo =  ReportManager.changePointToJsonString(fight, fighter, 0, target)
    table.insert(fight.actions,commandInfo);
    FightManager.playActions(commandInfo);


    --SkillRoleMgr.savePathFile(
    --"[" .. fight.frame .. "][EFFECT]Fighter " .. fighter.fighterId .. " Buff"
    --.. buff.modelId .. " 瞬移效果，目标" .. target.fighterId .. "(" .. target.position .. ")，坐标改变为：" .. fighter.position);

    return ClientFight.BaseBuffEffect.action(self,fight, buff, parameters);
end

t.New()